package chap4_5Properties类;

import java.util.Properties;
import java.util.Set;

/**
 * @author https://gitee.com/W_Jun
 * @date 2021-12-17 15:14
 * @Description Properties作为Map集合的使用
 */
public class PropertiesDemo01 {
    public static void main(String[] args) {
        //创建集合对象
        //Properties<String, String> prop = new Properties();//是错误的。Properties不能加泛型
        Properties prop = new Properties();

        //存储元素
        prop.put("id001", "刘一");
        prop.put("id002", "陈二");
        prop.put("id003", "张三");

        //遍历集合
        Set<Object> keySet = prop.keySet();
        for (Object key : keySet) {
            Object value = prop.get(key);
            System.out.println(key + "," + value);
        }
    }
}
